package com.igame.Controller;


import com.igame.Service.OrderService;
import com.igame.common.Result;
import com.igame.dto.OrderDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@CrossOrigin //忽视跨域问题
@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    OrderService orderService;
    @PostMapping("/obligation")
    public Result obligation(@RequestBody OrderDto orderDto){
        return orderService.addOrder(orderDto);
    }

    @PostMapping("/pendingReceipt")
    public Result pendingReceipt(@RequestBody OrderDto orderDto){
        return orderService.updateState(orderDto, 1);
    }

    //    确认收货
    @PostMapping("/confirmReceipt")
    public Result confirmReceipt(@RequestBody OrderDto orderDto){
        return  orderService.updateState(orderDto,2);
    }
}
